<%@page import="java.sql.*"%>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>执行多条sql语句测试</title>
</head>
<body>
<%
String url="jdbc:mysql://localhost:3306/db?serverTimezone=PRC&allowMultiQueries=true";
//(1)加载驱动
Class.forName("com.mysql.cj.jdbc.Driver");
//(2)创建连接
Connection cn = DriverManager.getConnection(url,"root","12qwas");
//(3)创建sql插入语句并设定参数的值
PreparedStatement ps = cn.prepareStatement("delete from chengyu where cy='一丁不识';delete from chengyu where cy like '一不%'");
int num=ps.executeUpdate();
out.print(num);
ps.close();
cn.close();
%>
</body>
</html>